为什么text="" 等于空的时候会出现类型不匹配?
来源:百度知道 编辑:UC知道 时间:2024/05/22 07:02:58
Public a As Integer, b As Integer
Private Sub Command1_Click()
a = Text1.Text
b = Text2.Text
If a > 23 Or b > 59 Then MsgBox ("输入的时间有误,请重新输入"), 16, 错误提示
Timer1.Enabled = True
Me.WindowState = 1 '最小化窗体
Me.Caption = "你要关机的时间是" & a & "时" & b & "分"
End Sub
代码如上
应该加些什么?
Private Sub Command1_Click()
a = Text1.Text
b = Text2.Text
If a > 23 Or b > 59 Then MsgBox ("输入的时间有误,请重新输入"), 16, 错误提示
Timer1.Enabled = True
Me.WindowState = 1 '最小化窗体
Me.Caption = "你要关机的时间是" & a & "时" & b & "分"
End Sub
代码如上
应该加些什么?
a = Text1.Text 'a赋值string是会出错
改成
a=val(text1.text)
Public a As Integer, b As Integer
Private Sub Command1_Click()
'在代码执行前先判断下文本框里面是否是数字,如果不是,就跳出过程
If IsNumeric(text1) = False Or IsNumeric(text2) = False Then
MsgBox "请输入数字"
Exit Sub
End If
a = Text1.Text
b = Text2.Text
If a > 23 Or b > 59 Then MsgBox ("输入的时间有误,请重新输入"), 16, 错误提示
Timer1.Enabled = True
Me.WindowState = 1 '最小化窗体
Me.Caption = "你要关机的时间是" & a & "时" & b & "分"
End Sub
val(text1.text) '将内容数字化
val(text2.text) '将内容数字化
a = Text1.Text
b = Text2.Text
改成
a = val(Text1.Text )
b = val(Text2.Text )
将字符型转化成数字型再赋给a,b
为什么session["n"]=TextBox2.Text.ToString()不起作用?
his.Label1.Text="您选择了"+this.ListBox1.SelectedItem.Text;其中的"+"为什么这么用?吗但详细解释下
imgpath = Application.CurrentProject.Path +"\" +认证项目.text +"\"+ 姓名.Text+".jpg"
$text = \"\";是什么含义
<STYLE TYPE="text/css">
一个vb查询语句SQL = "select * from 工程信息 where" & Combo(6).Text & "like" & Text(2).Text
<script language="JavaScript" type="text/JavaScript">
Print #1, IIf(LOF(1) = 0, "", ","); Text1.Text是什么意思啊?
webbrowser.navigate" "&text1.text
script type="text/vbscript问题